﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using GCELibrary.Current;
using ZF.BLL.ServiceModel;

namespace ZF.WS.service.btc
{
    public partial class jm : bopcontrol
    {



        protected void Page_Load(object sender, EventArgs e)
        {
            this.AirHtml1.Text = BConfig.Cooperation;
        }

        public void AddSubmit(object sender, EventArgs e)
        {
            if (!SiteInfo.ValidateCode(this.tbVCode.Text))
            {
                WarnFactory.CreateWarn(new PageWarnParameter()
                {
                    JscriptMode = true,
                    Link = WarnLink.GoBack,
                    Message = "验证码错误",
                }).Alert();
                return;
            }

            using (var dc = SiteInfo.CreateDBDataContext())
            {
                var srv = new Model.Sys_Service()
                {
                    AddTime = DateTime.Now,
                    IsAcc = false,
                    Type = (int)ServiceType.HZJM,
                    Json = Newtonsoft.Json.JsonConvert.SerializeObject(new HZJM()
                    {


                        Content = this.tbContent.Text,
                        Company = this.tbCompany.Text,
                        Fax = this.tbFax.Text,


                    }),

                    Contact = this.tbContact.Text,
                    Email = this.tbEmail.Text,
                    Tel = this.tbTel.Text,
                    Address = this.tbAddress.Text,

                };

                try
                {
                    dc.Sys_Service.InsertOnSubmit(srv);
                    dc.SubmitChanges();

                }
                catch (Exception ex)
                {
                    throw WarnFactory.CreateWarn(ex);
                }

                WarnFactory.CreateWarn(new PageWarnParameter()
                {
                    JscriptMode = true,
                    Message = "提交成功",
                    Link = WarnLink.GoBack,
                }).Alert();



            }



        }
 
    }
}